
<%@page import="java.sql.Connection" %>
<%@page import="java.sql.PreparedStatement" %>
<%@page import="java.sql.ResultSet" %>
<%@page import="java.sql.SQLException" %>
<%@page import="javax.sql.DataSource" %>
<%@page import="javax.naming.InitialContext" %>
<%@page import="javax.naming.NamingException" %>

<%
	DataSource DS;
	InitialContext cxt;
	DataSource ds = null;
	try {
		cxt = new InitialContext();
		ds = (DataSource) cxt.lookup("java:/comp/env/jdbc/HealthService");
	} catch (NamingException e) {
		ds = null;
		throw new IllegalStateException(
				"Impossibile recuperare il pool di connessioni al database: "
						+ e.getMessage());
	} finally {
		DS = ds;
	}
	String statement;//="Select nome from Categoria";
	Connection con;//=DS.getConnection();
	PreparedStatement pstmt;// = con.prepareStatement(statement);
	ResultSet rs;// =pstmt.executeQuery();
	
	String loginFabbrica = "";
	if(session.getAttribute("login")!=null)
		loginFabbrica = (String) session.getAttribute("login");
%>


<tr>
	<td style="float:left;">
		
		<script>
		function aperturaReclamo()
		{
		document.forms["apertura-reclamo"].submit();
		} 
		function viewReclami()
		{
		document.forms["view-reclami"].submit();
		}
		</script>
<% if (loginFabbrica!=null && !loginFabbrica.equals("")){//mostra il menu laterale %> 
<table width="192"  border="0" cellspacing="0" cellpadding="0">
      <tr align="left" valign="top">
        <td width="192" >
          <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          	<tr>
            	<td height="38" class="topMenu LeftMenuHeader" >Gestione Prodotti</td>
          	</tr>
             <tr>
              <td valign="top">
                <div class="RightMenu">
                  <ul>
                  	<% if(loginFabbrica.equals("sedecentrale")) { %>
                    <li><a href="create_prodotto_servlet?action=pre" id="WhiteColor2">Crea Prodotto</a></li>	
					<li><a href="create_categoria.jsp" id="WhiteColor2">Crea Categoria</a></li>	
					<li><a href="view_ordini_clienti" id="WhiteColor2">Visualizza Ordini Clienti</a></li>
					  <% } %> 	
					<li><a href="view_magazzino.jsp" id="WhiteColor2">Visualizza Magazzino</a></li>
					<li><a href="distinta_base.jsp" id="WhiteColor2">Distinta Base</a></li>
                  </ul>
              </div>
              </td>
            </tr>
            <% if(loginFabbrica.equals("sedecentrale")) { %>
             <tr>
            	<td height="38" class="topMenu LeftMenuHeader" >Gestione Reclami</td>
          	</tr>
             <tr>
              <td valign="top">
                <div class="RightMenu">
                  <ul>
                    <li><a href="view_reclami_centrale.jsp" id="WhiteColor2">Visualizza Reclami</a></li>		
                  </ul>
              </div>
              </td>
            </tr>
             <% } %>
          
            
            <tr>
            	<td height="38" class="topMenu LeftMenuHeader" >Gestione Produzione</td>
          	</tr>
             <tr>
              <td valign="top">
                <div class="RightMenu">
                  <ul>
                  	<li><a href="save_produzione.jsp" id="WhiteColor2">Aggiorna In Produzione</a></li>	
                  <% if(loginFabbrica.equals("sedecentrale")) { %>
                    <li><a href="update_produzione_fabbrica" id="WhiteColor2">Aggiorna Produzione</a></li>
                    <li><a href="create_produce.jsp" id="WhiteColor2">Crea Produce</a></li>
                   <% } %>  
                  </ul>
              </div>
              </td>
            </tr>
            
            <tr>
            	<td height="38" class="topMenu LeftMenuHeader" >Gestione M. Prime</td>
          	</tr>
             <tr>
              <td valign="top">
                <div class="RightMenu">
                  <ul>
                    <li><a href="ordina_materia_prima.jsp" id="WhiteColor2">Crea Ordine M.P.</a></li>
					 <% if(loginFabbrica.equals("sedecentrale")) { %>
					<li><a href="view_materia_prima.jsp" id="WhiteColor2">Gestisci M.P.</a></li>
					  <% } %> 
					<li><a href="view_ordini_fabbriche" id="WhiteColor2">Visualizza Ordini Fabbriche</a></li>	
					<li><a href="view_deposito.jsp" id="WhiteColor2">Visualizza Depositi</a></li>
                  </ul>
              </div>
              </td>
            </tr>
            
            
  
            <tr>
            	<td height="38" class="topMenu LeftMenuHeader" >Gestione Fornitori</td>
          	</tr>
            <tr>
              <td valign="top">
                <div class="RightMenu">
                  <ul>
                  	<% if(loginFabbrica.equals("sedecentrale")) { %>
                   <li><a href="create_fornitore" id="WhiteColor2">Crea Fornitore</a></li>
                   <li><a href="create_ordine_fornitore" id="WhiteColor2">Crea Ordine Fornitore</a></li>
                    <% } %>
                    <li><a href="view_ordini_fornitura" id="WhiteColor2">Visualizza Ordini Fornitori</a></li>
					<li><a href="view_fornitori" id="WhiteColor2">Visualizza Fornitori</a></li>
					<% if(loginFabbrica.equals("sedecentrale")) { %>
					<li><a href="assegna_fornitori.jsp" id="WhiteColor2">Assegna Fornitori</a></li>		
					 <% } %>
                  </ul>
              </div>
              </td>
            </tr>
            
            
             <% if(loginFabbrica.equals("sedecentrale")) { %>
            <tr>
            	<td height="38" class="topMenu LeftMenuHeader" >Gestione Fabbriche</td>
          	</tr>
            <tr>
              <td valign="top">
                <div class="RightMenu">
                  <ul>
              
                    <li><a href="create_fabbrica" id="WhiteColor2">Crea Fabbrica</a></li>
                
					<li><a href="view_fabbriche" id="WhiteColor2">Visualizza Fabbriche</a></li>		
                  </ul>
              </div>
              </td>
            </tr>
                <% } %>
            
          </table>
          </td>
      </tr>
</table>
<% } //chiude il menu laterale%>
</td>
	<td width="727" style="float:right;">
					
